package api;

import model.Entry;
import model.Item;
import model.Type;
import persistence.EntryDAO;

import java.util.Date;

/**
 * @author Mikhail Larinskiy
 */
public class BudgetAPI {
	private static BudgetAPI instance;

	private BudgetAPI() {
	}

	public static BudgetAPI instance() {
		if (instance == null) {
			instance = new BudgetAPI();
		}

		return instance;
	}

	public void addEntry(double sum, Date date, Item item) {
		Entry newEntry = new Entry(sum, date, item);

		new EntryDAO().persistEntry(newEntry);
	}

	public Entry getEntry() {
		return new EntryDAO().getEntry();
	}
}
